﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<script language="javascript" src="../../../js/busyload/cvi_busy_lib.js"></script>
<script language="javascript" src="../../../js/busyload/pub_load.js"></script>
 
<script language="javascript" src="../../../js/common.js"></script>
<script language="javascript" src="../../../js/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="../../../themes/css/right.css" />
 
<link rel="stylesheet" type="text/css" href="../../../themes/css/blueStyle.css" />
<script src="../../../js/scripts/boot.js" type="text/javascript"></script> 
<link href="../../../js/scripts/miniui/themes/default/skin.css" rel="stylesheet" type="text/css">
<link href="../../../js/scripts/miniui/themes/blue/skin.css" rel="stylesheet" type="text/css">
<link href="../../../js/scripts/miniui/themes/blue2003/skin.css" rel="stylesheet" type="text/css">
<link href="../../../js/scripts/miniui/themes/blue2010/skin.css" rel="stylesheet" type="text/css">
<!--
<link href="../../../js/scripts/miniui/themes/gray/skin.css" rel="stylesheet" type="text/css">
<link href="../../../js/scripts/miniui/themes/olive2003/skin.css" rel="stylesheet" type="text/css">
-->
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>部门管理</title>
</head>
<body>
	<form action="CompanyAction_list.do" name="form1" method="get">
		
<div style="height: 5px;"></div>
  <div style="margin-left:4px;width:99%;">
        <div class="mini-toolbar" style="border-bottom:0;padding:0px;">
            <table style="width:100%;">
                <tr>
                    <td style="width:100%;">
                        <a class="mini-button" iconCls="icon-add" onclick="addRow()" plain="true">增加</a>
                        <a class="mini-button" iconCls="icon-remove" onclick="removeRow()" plain="true">删除</a>
                        <span class="separator"></span>
                        <a class="mini-button" iconCls="icon-save" onclick="saveData()" plain="true">保存</a>            
                    </td>
                    <td style="white-space:nowrap;">
                        <input id="key" class="mini-textbox" emptyText="请输入姓名" style="width:150px;" onenter="onKeyEnter"/>   
                        <a class="mini-button" onclick="search()">查询</a>
                    </td>
                </tr>
            </table>           
        </div>
    </div>

	<div id="datagrid1" class="mini-datagrid" style="margin-left:4px;width:99%;height:480px;" 
        url="../../../_data/data.txt" idField="id"
        allowResize="true" pageSize="20" 
        allowCellEdit="true" allowCellSelect="true" multiSelect="true"
        editNextOnEnterKey="true" 
    >
              <div property="columns">
            <div type="indexcolumn"></div>
            <div type="checkcolumn"></div>
            <div field="loginname" allowResize="false" width="120" headerAlign="center" allowSort="true">员工帐号
                <input property="editor" class="mini-textbox" style="width:100%;" />
            </div>
            <div field="age" width="100" allowSort="true" >年龄
                <input property="editor" class="mini-spinner"  minValue="0" maxValue="200" value="25" style="width:100%;"/>
            </div>            
            <div name="birthday" field="birthday" width="100" allowSort="true" dateFormat="yyyy-MM-dd">出生日期
                <input property="editor" class="mini-datepicker" style="width:100%;"/>
            </div>    
            <div field="remarks" width="120" headerAlign="center" allowSort="true">备注
                <input property="editor" class="mini-textarea" style="width:100%;" minHeight="50"/>
            </div>
            <!--ComboBox：本地数据-->         
            <div type="comboboxcolumn" autoShowPopup="true" name="gender" field="gender" width="100" allowSort="true"  align="center" headerAlign="center">性别
                <input property="editor" class="mini-combobox" style="width:100%;" data="Genders" />                
            </div>                              
            <!--ComboBox：远程数据-->
            <div type="comboboxcolumn" field="country" width="100" headerAlign="center" >国家
                <input property="editor" class="mini-combobox" style="width:100%;" url="../../../_data/countrys.txt" />                
            </div>   
            <div type="checkboxcolumn" field="married" trueValue="1" falseValue="0" width="60" headerAlign="center">婚否</div>            
        </div>
    </div>


    
    <script type="text/javascript">
    	var Genders = [{ id: 1, text: '男' }, { id: 2, text: '女'}];
        mini.parse();

        var grid = mini.get("datagrid1");
        grid.load();

    	
		function addRow() {          
            var newRow = { name: "New Row" };
            grid.addRow(newRow, 0);
        }
        function removeRow() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                grid.removeRows(rows, true);
            }
        }
		
		 function saveData() {
            var data = grid.getChanges();
            
            var json = mini.encode(data);
            alert(data+","+json);
            grid.loading("保存中，请稍后......");
            $.ajax({
                url: "/xweb/jqueryTest.do?method=SaveEmployees",
                data: { data: json },
                type: "post",
                success: function (text) {
                    grid.reload();
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                }
            });
        }
    </script>
				
		
	</form>
</body>
</html>




